package net.suplementos.web.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Map;

import org.apache.struts2.util.StrutsTypeConverter;

public class DataConverter extends StrutsTypeConverter {

	private SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");

	@Override
	public Object convertFromString(Map contexto, String[] parametros, Class toClass) {
		try {
			return format.parse(parametros[0]);
		} catch (ParseException e) {

		}
		return null;
	}

	@Override
	public String convertToString(Map contexto, Object objToConvert) {
		return format.format(objToConvert);
	}

}
